<template>
    <div>
        <h1>登录</h1>
        <table class="table table-bordered">
            <tbody>
                <tr>
                    <td>账号</td>
                    <td><input type="text" v-model="info.username"></td>
                </tr>
                <tr>
                    <td>密码</td>
                    <td><input type="password" v-model="info.pwd"></td>
                </tr>
                <tr>
                    <td></td>
                    <td><input type="button" value="登录" @click="ok"></td>
                </tr>
            </tbody>
        </table>
    </div>
</template>

<script setup lang="ts">
import { ref, reactive, onMounted } from 'vue'
import axios from 'axios';
import moment from 'moment';
import { useRouter, useRoute } from 'vue-router';
const router = useRouter();
const route = useRoute();
let info: any = reactive({
    username: '',
    pwd: ''
})
const ok = () => {
    axios({
        url: '/api/Room/Loght',
        method: 'get',
        params: info
    })
        .then(res => {
            if (res.data == -1) {
                alert('账号错误')
                return;
            }
            if (res.data == -2) {
                alert('密码错误')
                return;
            }
            alert('登陆成功')
            router.push("/")
            return;

        })
}
</script>

<style scoped></style>